you can achieve this task by using the code given below:
Fisrt step: Create a class and add some properties:
public class Sample { public string Name { get; set; } public int Age { get;set; } }
Second step: Add some sample data in the list
using System.Collections;
List<Sample> list =new List<Sample>();
list.Add( new Sample { Name="Rohit", Age=20 });
list.Add( new Sample
{
Name="Rohit",
Age=20
});
Third Step: Bind list as datasource of gridcontrol.
gridControl1.DataSource = list;
Note:You also have to add the two fields in devexpress gridview and provide the FieldName of column as name of the property.
Liked By
Write Answer
How to bind List<T> data in devexpress XtraGrid control?
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy
Join MindStick Community
You have need login or register for voting of answers or question.
Chris Anderson
13-Jun-2012you can achieve this task by using the code given below:
Fisrt step: Create a class and add some properties:
public class Sample
{
public string Name { get; set; }
public int Age { get;set; }
}
Second step: Add some sample data in the list
using System.Collections;
List<Sample> list =new List<Sample>();
list.Add( new Sample
{
Name="Rohit",
Age=20
});
list.Add( new Sample
{
Name="Rohit",
Age=20
});
Third Step: Bind list as datasource of gridcontrol.
gridControl1.DataSource = list;
Note:You also have to add the two fields in devexpress gridview and provide the FieldName of column as name of the property.